package top.suven.base.http.jetty.settings;


import top.suven.base.core.jetty.HttpServerPort;
import top.suven.base.util.constants.GlobalConstants;
import org.apache.commons.beanutils.PropertyUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;


@Configuration("serverPort")
@ConfigurationProperties(prefix = GlobalConstants.JETTY_SERVER_PORT_SETTINGS)
public class JettyServerPortSettings {
    private HttpServerPort http = new HttpServerPort();
    private RpcServerPort rpc = new RpcServerPort();



    public int getPort(String key) {
       int port = 0;
        try{
            port = (Integer)PropertyUtils.getProperty(http, key);
        }catch (Exception e){ }
        return port;
    }
    public int getRpcPort(String key) {
        int port = 0;
        try{
            port = (Integer)PropertyUtils.getProperty(rpc, key);
        }catch (Exception e){ }
        return port;
    }

    public HttpServerPort getHttp() {
        return http;
    }

    public void setHttp(HttpServerPort http) {
        this.http = http;
    }

    public RpcServerPort getRpc() {
        return rpc;
    }

    public void setRpc(RpcServerPort rpc) {
        this.rpc = rpc;
    }


    public class  RpcServerPort{
        private int user = 29010;
        private int oauth  = 29020;
        private int resource  = 29030;
        private int pay  = 29040;
        private int assets  = 29050;
        private int pad  = 29060;
        private int order  = 29070;
        private int activity  = 29080;
        private int desktop  = 29090;
        private int config  = 29100;
        private int mq = 29110;
        private int task = 29120;
        private int three  = 29130;
        private int market  = 29140;
        private int log  = 29150;



        public int getActivity() {
            return activity;
        }

        public void setActivity(int activity) {
            this.activity = activity;
        }

        public int getAssets() {
            return assets;
        }

        public void setAssets(int assets) {
            this.assets = assets;
        }

        public int getConfig() {
            return config;
        }

        public void setConfig(int config) {
            this.config = config;
        }

        public int getDesktop() {
            return desktop;
        }

        public void setDesktop(int desktop) {
            this.desktop = desktop;
        }

        public int getMarket() {
            return market;
        }

        public void setMarket(int market) {
            this.market = market;
        }

        public int getOauth() {
            return oauth;
        }

        public void setOauth(int oauth) {
            this.oauth = oauth;
        }

        public int getOrder() {
            return order;
        }

        public void setOrder(int order) {
            this.order = order;
        }

        public int getPad() {
            return pad;
        }

        public void setPad(int pad) {
            this.pad = pad;
        }

        public int getPay() {
            return pay;
        }

        public void setPay(int pay) {
            this.pay = pay;
        }

        public int getResource() {
            return resource;
        }

        public void setResource(int resource) {
            this.resource = resource;
        }

        public int getUser() {
            return user;
        }

        public void setUser(int user) {
            this.user = user;
        }

        public int getLog() {
            return log;
        }

        public void setLog(int log) {
            this.log = log;
        }

        public int getMq() {
            return mq;
        }

        public void setMq(int mq) {
            this.mq = mq;
        }

        public int getThree() {
            return three;
        }

        public void setThree(int three) {
            this.three = three;
        }

        public int getTask() {
            return task;
        }

        public void setTask(int task) {
            this.task = task;
        }
    }






}
